/*
** my_showstr.c for my_showstr in /home/labonn_c//Documents/piscine/Jour_O6
** 
** Made by christophe labonnemartinez
** Login   <labonn_c@epitech.net>
** 
** Started on  Tue Oct 11 15:49:51 2011 christophe labonnemartinez
** Last update Tue Oct 11 15:52:57 2011 christophe labonnemartinez
*/

int	conversion2(char str)
{
  if (str == 1 || str == 17)
    my_putchar('1');
  else if (str == 2 || str == 18)
    my_putchar('2');
  else if (str == 3 || str == 19)
    my_putchar('3');
  else if (str == 4 || str == 20)
    my_putchar('4');
  else if (str == 5 || str == 21)
    my_putchar('5');
  else if (str == 6 || str == 22)
    my_putchar('6');
  else if (str == 7 || str == 23)
    my_putchar('7');
  else if (str == 8 || str == 24)
    my_putchar('8');
  else if (str == 9 || str == 25)
    my_putchar('9');
}
int	conversion3(char str)
{
  if (str == 10 || str == 26)
    my_putchar('A');
  else if (str == 11 || str == 27)
    my_putchar('B');
  else if (str == 12 || str == 28)
    my_putchar('C');
  else if (str == 13 || str == 29)
    my_putchar('D');
  else if (str == 14 || str == 30)
    my_putchar('E');
  else if (str == 15 || str == 31)
    my_putchar('F');
  else if (str == 16)
    my_putchar('0');
  else if (str == 17)
    my_putchar('1');
  else if (str == 18)
    my_putchar('2');
  else if (str == 19)
    my_putchar('3');
}

int	conversion1(str)
{
  my_putchar('\\');
  if (str < 15)
    {
      my_putchar('0');
      conversion2(str);
      conversion3(str);
    }
  else
    {
      my_putchar('1');
      conversion2(str);
      conversion3(str);
    }

}

int	my_showstr(char *str)
{
  while (*str != '\0')
    {
      if (*str < 32)
	conversion1(*str);
      else
	my_putchar(*str);
      str = str + 1;
    }
  return (0);
}
